<?php
    session_start();
    include_once '../../../../controlador/php/conexion/Conexion.php'; 
    
    $con = new Conexion();
    
    $oid = $_REQUEST['oid'];
    $obs = $_REQUEST['obs'];
    $cancel = $_REQUEST['cancel'];
    
    $select = "select proid from pcprogambu where folioid=".$oid;
    $res = $con->query($select);
    
    while($res2 = mssql_fetch_array($res)){
        $oidp = $res2['proid'];
    }
    
    $update = "update pcprogambu
               set proestado = 6,
                   procancelado = '".$cancel."' 
               where folioid=".$oid;
    $con->query($update);
    
    $insert = "insert into pchisambu(hisestado,usuoid,hisfecha,proid,hisobserv,hispqrp,hiscancelado)values('6','".$_SESSION['usuario']."',GETDATE(),'".$oidp."','".$obs."','','".$cancel."')";
    $con->query($insert);
    
    print_r(json_encode(array('mensaje'=>'La programacion se anulo')));
    
    $con->cerrarConexion() ;
?>

